<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>登录</title>
    
	<meta charset="UTF-8">
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" type="text/css" href="css/modle.css">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
		.main-body-div{
			height: 550px;
			background: none;
			border: none;
		}
		form{
			width: 400px;
			height: 300px;
			margin: 0px auto;
			margin-top: 5%;
		}
		table{
			width: 100%;
			height: 100%;
			border: 1px solid #8b8b8b;
			background: white;
			border-radius: 5px;
		}
		tr{
			line-height: 30px;
		}
		table tr:FIRST-CHILD td{
			text-align: center;
		}
		tr td:FIRST-CHILD{
			width: 25%;
			text-align: right;
		}
		tr td:LAST-CHILD{
			width: 75%;
			text-align: left;
		}
		table tr:LAST-CHILD td{
			text-align: center;
		}
		input {
			width: 80%;
		}
		input[type='submit'] {
			width:50%;
			height: 35px;
			border-radius: 5px;
			background: blue;
			color: white;
			margin: 10px;
			font-size: 16px;
			font-weight: bold;
		}
	</style>
	<script src="js/jquery-1.12.4.js"></script>
	<script type="text/javascript">
		function formValidation(){
			var account=$("#account").val();
			var pwd=$("#pwd").val();
			if(account==''){
				alert("账号不能为空");
				return false;
			}
			
			if(pwd==''){
				alert("密码不能为空");
				return false;
			}
			return true;
		}
		
		$(function(){
			$("#loginform").submit(function(){
				return formValidation();
			});
		});
	</script>
  </head>
  
  <body class="mybody">
  	<div class="main">
  		<div class="index-title">
  			<iframe src="index-b-elem/header.jsp" frameborder="0" id="title-if"></iframe>
  		</div>
	    <div class="main-body-div">
	    	<form action="doLogin" method="post" id="loginform">
		      <table>
		      	<tr>
		        	<td colspan="2">
		        		<h2>登&nbsp;&nbsp;&nbsp;&nbsp;录</h2>
		        	</td>
		        </tr>
		        <% 
		        	String name="";
		        	Cookie[] cs=request.getCookies();
		        	if(cs!=null){
		        		for(Cookie c:cs){
		        			if(c.getName().equals("logername")){
		        				name=c.getValue();
		        			}
		        		}
		        	}
		    	%>
		        <tr>
		          <td>账&nbsp;&nbsp;号：</td>
		          <td><input type="text" id="account" name="account" value="<%=name%>"/></td>
		        </tr>
		        <tr>
		          <td>密&nbsp;&nbsp;码：</td>
		          <td><input type="password" id="pwd" name="pwd"/></td>
		        </tr>
		        <tr>
		        	<td colspan="2">
		        		<input type="submit" value="登&nbsp;&nbsp;&nbsp;&nbsp;录"/>
		        	</td>
		        </tr>
		      </table>
		    </form>
		</div>
		<div class="index-footer">
  			<iframe src="index-b-elem/footer.jsp" frameborder="0" id="title-if"></iframe>
  		</div>
   	</div>
  </body>
</html>
